#pragma once

#include "Statement.h"
#include "Statement_List.h"
#include "Expression.h"

MAKE_PTR(CStatementWhile);

class CStatementWhile : public CStatement
{
public:
	static CStatementWhilePtr create(
		CExpressionPtr exp,
		CStatementListPtr statement
		)
	{
		return CStatementWhilePtr(new CStatementWhile(exp, statement));
	}
public:
	CStatementWhile(		
		CExpressionPtr exp,
		CStatementListPtr statement
		)
		:m_pExp(exp), m_pStatement(statement)
	{

	}

protected:
	CExpressionPtr m_pExp;
	CStatementListPtr m_pStatement;

protected:
	EvalType doEval()
	{
		while(m_pExp->eval())
		{
			m_pStatement->eval();
		}

		return 0;
	}
};